//
//  Line.m
//  touch-demo
//
//  Created by holyen on 12-10-10.
//  Copyright (c) 2012年 holyen. All rights reserved.
//

#import "Line.h"

@implementation Line
@synthesize begin = _begin;
@synthesize end = _end;
@synthesize color = _color;

- (id)initWithCoder:(NSCoder *)aDecoder
{
    self = [super init];
    if (self)
    {
        [self setBegin:CGPointMake([aDecoder decodeFloatForKey:@"begin.x"], [aDecoder decodeFloatForKey:@"begin.y"])];
        
        [self setEnd:CGPointMake([aDecoder decodeFloatForKey:@"end.x"], [aDecoder decodeFloatForKey:@"end.y"])];
        [self setColor:[UIColor blackColor]];
    }
    return self;
}

- (void)dealloc
{
    [_color release];
    [super dealloc];
}

- (void)encodeWithCoder:(NSCoder *)aCoder
{
    [aCoder encodeFloat:self.begin.x forKey:@"begin.x"];
    [aCoder encodeFloat:self.begin.y forKey:@"begin.y"];
    
    [aCoder encodeFloat:self.end.x forKey:@"end.x"];
    [aCoder encodeFloat:self.end.y forKey:@"end.y"];
}

@end
